package com.shangyitong.yygh_hosp.controller;

import com.shangyitong.Result;
import com.shangyitong.yygh.model.hosp.Schedule;
import com.shangyitong.yygh_hosp.service.ScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("admin/hosp/schedule")
@Slf4j
@Api(value = "查询预约规则")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    /**
     * 查询预约规则
     * finished
     * @param page
     * @param limit
     * @param hoscode
     * @param depcode
     * @return
     */
    @ApiOperation(value = "查询预约规则")
    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleRule(@PathVariable Integer page,
                                  @PathVariable Integer limit,
                                  @PathVariable String hoscode,
                                  @PathVariable String depcode){
        Map<String, Object> mapSchedule = scheduleService.getScheduleRule(page, limit, hoscode, depcode);
        return Result.ok(mapSchedule);
    }
    /**
     * 查询排班信息
     * finished
     * @param hoscode
     * @param depcode
     * @param workDate
     * @return
     */
    @ApiOperation(value = "查询排班详情")
    @GetMapping("getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(@PathVariable String hoscode,
                                    @PathVariable String depcode,
                                    @PathVariable String workDate){
        List<Schedule> schedules = scheduleService.getScheduleDetail(hoscode, depcode, workDate);
        return Result.ok(schedules);
    }
}
